// 接口拦截
//定义允许直接访问的url
const HttpExceptionError = require("./http-exception")
const allowpage = ['/','/404']
//拦截
function localFilter(ctx) {
    let url = ctx.originalUrl
    if (allowpage.indexOf(url) > -1) {
        console.info('当前地址可直接访问')
    }else {
        ctx.redirect('/404')
        throw new HttpExceptionError('没有访问权限',10000,500)
        
    }
}

module.exports = localFilter